<include file="../Public/_header.html" />
<script  type="text/javascript" src="__PUBLIC__/Js/rcalendar.js" ></script>

<div class="so_main">
	<php>if($type!='edit'){</php>
  		<div class="page_tit">录入货架</div>
  <php>}else{</php>
  		<div class="page_tit">修改货架</div>
  <php>}</php>
  <style>
  	.form2 dl{
  		float: left;
    	width: 50%;
    }
  </style>
  <div class="form2">
  	<form method="post" 
  		<php>if($type!='edit'){</php>
  				action="{:U('/Shelf/doPuton')}" 
		  <php>}else{</php>
		  		action="{:U('/Shelf/doEdit')}" 
		  <php>}</php>
			>
  	<input name="id" type="hidden" value="{$shelf['id']}">
  	<div class="clear"></div>
   	<dl class="lineD" style="font-weight:bold;">
      <dt style="padding: 5px 0px 8px 0px;">基本信息：</dt>
    </dl>
    <dl class="lineD">
				<dt style="color:red;">是否生效：</dt>
				<dd>
					<span>
						<input name="enable" type="checkbox" <php>if($shelf['enable'] == 'Y') {</php> checked = "checked" <php>}</php> value="Y">
						钩选为生效
					</span>
				</dd>
		</dl>

    
    <php>if($type!='edit'){</php>
  	<dl class="lineD">
      <dt>选择商户：</dt>
      <dd>
        <php>$partner_id=getParnterIdByGoodsId($shelf['goods_id']);</php>
        <input id="partnerdesc" type="text" value="{:getParnterTitle($partner_id)}"
					        onclick="k_pop_syncSearch('partner_id'
					        													,'partnerdesc'
					        													,'选择商户'
					        													,'{:U('Admin://Partner/getJson')}'
					        													,function(){ $('#goodsdesc').click(); }
					        													,function(){ $('#goodsdesc').val('');$('#goods_id').val('');
					        																			 $('#market_price').val('');$('#total_number').val(''); })" 
					        readonly >
					        <input id="partner_id" type="hidden" value="{$partner_id}">
		</select>
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>选择商品：</dt>
      <dd>
        <input id="goodsdesc" type="text" value="{:getGoodsTitle($shelf['goods_id'])}"
					        onclick="if( $('#partner_id').val()=='' ){ $('#partnerdesc').click();return; }
					        					k_pop_syncSearch('goods_id'
					        													,'goodsdesc'
					        													,'选择商品'
					        													,'{:U('Admin://Goods/getJson',array('partner_id'=>''))}'+$('#partner_id').val()
					        													,function() {		  
					        																			k_pop_goodsprice('{:U('Admin://Price/getAvailabePrice')}',$('#goods_id').val(),'商品 '+$('#goodsdesc').val()+' 当前价格');
					        																			}
					        													,null)" 
					        readonly >
					        <input name="goods_id" id="goods_id" type="hidden" value="{$shelf['goods_id']}">
      </dd>
    </dl>
	  <php>}else{</php>
	  <dl class="lineD">
      <dt>选择商户：</dt>
      <dd>
        <php>$partner_id=getParnterIdByGoodsId($shelf['goods_id']);</php>
        <input id="partnerdesc" type="text" value="{:getParnterTitle($partner_id)}"
					        readonly >
					        <input id="partner_id" type="hidden" value="{$partner_id}">
		</select>
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>选择商品：</dt>
      <dd>
        <input id="goodsdesc" type="text" value="{:getGoodsTitle($shelf['goods_id'])}"
					        readonly >
					        <input name="goods_id" id="goods_id" type="hidden" value="{$shelf['goods_id']}">
      </dd>
    </dl>
	  <php>}</php>
    
    <dl class="lineD">
      <dt>市场价格：</dt>
      <dd>
        <input name="market_price" id="market_price" type="text" value="{$shelf.market_price}" 
        				onclick="if( $('#goods_id').val()=='' ){ $('#goodsdesc').click();return; }
					        				k_pop_goodsprice('{:U('Admin://Price/getAvailabePrice')}'
					        				,$('#goods_id').val()
					        				,'商品 '+$('#goodsdesc').val()+' 当前价格');
												" 
        				readonly>
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>进货总量：</dt>
      <dd>
        <input name="total_number" id="total_number" type="text" value="{$shelf.total_number}" 
        				onclick="if( $('#goods_id').val()=='' ){ $('#goodsdesc').click();return; }
					        				k_pop_goodsprice('{:U('Admin://Price/getAvailabePrice')}'
					        				,$('#goods_id').val()
					        				,'商品 '+$('#goodsdesc').val()+' 当前价格');
												" 
        				readonly>
      </dd>
    </dl>

    <dl class="lineD">
      <dt>销售价格：</dt>
      <dd>
        <input name="out_price" type="text" value="{$shelf.out_price}">
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>已销售量：</dt>
      <dd>
        <input name="send_number" type="text" value="<php>if(empty($shelf['send_number'])){echo 0;}else{echo $shelf['send_number'];}</php>" readonly>
      </dd>
    </dl>
		
		<dl class="lineD">
      <dt>上架分类：</dt>
      <dd>
        <input id="sortdesc" type="text" value="{$shelf['sort_id']|getCategoryName}" 
		      					onclick="ui.box.load(
		    											'{:U('Index://Public/showtree',array('code'=>'shelf'))}'
		    											,{ title:'查看上架分类' })"
		      					readonly>
		    <input id="sort_id" name="sort_id" type="hidden" value="{$shelf['sort_id']}">
					<script>
							function _tmp_setselectdict(rel,txt){
					    		$('#sortdesc').val(txt);
					    		$('#sort_id').val(rel);
					    }
					</script>
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>获得积分：</dt>
      <dd>
        <input name="gain_credit" type="text" value="<php>if(empty($shelf['gain_credit'])){echo 0;}else{echo $shelf['gain_credit'];}</php>">
      </dd>
    </dl>

    
    
    <dl class="lineD">
      <dt>上架时间：</dt>
      <dd>
        <input name="on_time" id="on_time" type="text" class="input_text" 
        value="{:paramMillisecond2Date($shelf['on_time'],'Y-m-d H:i', date('Y-m-d H:i',time()) )}"
        onfocus="rcalendar(this,'full');" readonly
        />
      </dd>
    </dl>
    
    
    <dl class="lineD">
      <dt>下架时间：</dt>
      <dd>
        <input name="off_time" type="text"  class="input_text"
        value="{:paramMillisecond2Date($shelf['off_time'],'Y-m-d H:i', date('Y-m-d H:i',time()) )}"
        onfocus="rcalendar(this,'full');" readonly
        />
      </dd>
    </dl>
    
	
	<div class="clear"></div>
 
    <div class="page_btm" style="padding: 18px 0 18px 0;text-align: center;">
      <input type="submit" class="btn_b" value="提交" />
    </div>
    </form>
  </div>

</div>
<script>
$(document).ready(function(){
	
	loadEditor("detail");
});
</script>
<include file="../Public/_footer.html" />